class MyPrescDataList {
  int? total;
  List<MyPrescListData>? list;

  MyPrescDataList({this.total, this.list});

  MyPrescDataList.fromJson(Map<String, dynamic> json) {
    if (json["total"] is int) {
      total = json["total"];
    }
    if (json["list"] is List) {
      list = json["list"] == null
          ? null
          : (json["list"] as List)
              .map((e) => MyPrescListData.fromJson(e))
              .toList();
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> _data = <String, dynamic>{};
    _data["total"] = total;
    if (list != null) {
      _data["list"] = list?.map((e) => e.toJson()).toList();
    }
    return _data;
  }
}

class MyPrescListData {
  int? id;
  String? patientNo;
  String? prescriptionNo;
  int? price;
  int? repeatFlag;
  String? diagnosis;
  String? usageDosage;
  String? doctorNo;
  String? patientName;
  String? gender;
  String? createTime;
  int? status;
  List<Drugs>? drugs;

  MyPrescListData(
      {this.id,
      this.patientNo,
      this.prescriptionNo,
      this.price,
      this.repeatFlag,
      this.diagnosis,
      this.usageDosage,
      this.doctorNo,
      this.patientName,
      this.gender,
      this.createTime,
      this.status,
      this.drugs});

  MyPrescListData.fromJson(Map<String, dynamic> json) {
    if (json["id"] is int) {
      id = json["id"];
    }
    if (json["patientNo"] is String) {
      patientNo = json["patientNo"];
    }
    if (json["prescriptionNo"] is String) {
      prescriptionNo = json["prescriptionNo"];
    }
    if (json["price"] is int) {
      price = json["price"];
    }
    if (json["repeatFlag"] is int) {
      repeatFlag = json["repeatFlag"];
    }
    if (json["diagnosis"] is String) {
      diagnosis = json["diagnosis"];
    }
    if (json["usageDosage"] is String) {
      usageDosage = json["usageDosage"];
    }
    if (json["doctorNo"] is String) {
      doctorNo = json["doctorNo"];
    }
    if (json["patientName"] is String) {
      patientName = json["patientName"];
    }
    if (json["gender"] is String) {
      gender = json["gender"];
    }
    if (json["createTime"] is String) {
      createTime = json["createTime"];
    }
    if (json["status"] is int) {
      status = json["status"];
    }
    if (json["drugs"] is List) {
      drugs = json["drugs"] == null
          ? null
          : (json["drugs"] as List).map((e) => Drugs.fromJson(e)).toList();
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> _data = <String, dynamic>{};
    _data["id"] = id;
    _data["patientNo"] = patientNo;
    _data["prescriptionNo"] = prescriptionNo;
    _data["price"] = price;
    _data["repeatFlag"] = repeatFlag;
    _data["diagnosis"] = diagnosis;
    _data["usageDosage"] = usageDosage;
    _data["doctorNo"] = doctorNo;
    _data["patientName"] = patientName;
    _data["gender"] = gender;
    _data["createTime"] = createTime;
    _data["status"] = status;
    if (drugs != null) {
      _data["drugs"] = drugs?.map((e) => e.toJson()).toList();
    }
    return _data;
  }
}

class Drugs {
  int? id;
  int? repeatId;
  int? drugId;
  String? drugName;
  String? isRepeat;
  String? usageDosage;
  String? usageCount;
  String? usageDays;
  String? timesCount;
  int? count;

  Drugs(
      {this.id,
      this.repeatId,
      this.drugId,
      this.drugName,
      this.isRepeat,
      this.usageDosage,
      this.usageCount,
      this.usageDays,
      this.timesCount,
      this.count});

  Drugs.fromJson(Map<String, dynamic> json) {
    if (json["id"] is int) {
      id = json["id"];
    }
    if (json["repeatId"] is int) {
      repeatId = json["repeatId"];
    }
    if (json["drugId"] is int) {
      drugId = json["drugId"];
    }
    if (json["drugName"] is String) {
      drugName = json["drugName"];
    }
    if (json["isRepeat"] is String) {
      isRepeat = json["isRepeat"];
    }
    if (json["usageDosage"] is String) {
      usageDosage = json["usageDosage"];
    }
    if (json["usageCount"] is String) {
      usageCount = json["usageCount"];
    }
    if (json["usageDays"] is String) {
      usageDays = json["usageDays"];
    }
    if (json["timesCount"] is String) {
      timesCount = json["timesCount"];
    }
    if (json["count"] is int) {
      count = json["count"];
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> _data = <String, dynamic>{};
    _data["id"] = id;
    _data["repeatId"] = repeatId;
    _data["drugId"] = drugId;
    _data["drugName"] = drugName;
    _data["isRepeat"] = isRepeat;
    _data["usageDosage"] = usageDosage;
    _data["usageCount"] = usageCount;
    _data["usageDays"] = usageDays;
    _data["timesCount"] = timesCount;
    _data["count"] = count;
    return _data;
  }
}
